home *** CD-ROM | disk | FTP | other *** search
- on htmlregister mem
- end
-
- on htmlstartmovie
- global ghtmlnormfont, ghtmlheadfont, ghtmlttfont, ghtmlfontsize, ghtmlpath, glasturl, ghtmllinkred, ghtmllinkgreen, ghtmllinkblue, ghtmlsmoothness, ghtmlmargin, gmac, gsep
- htmlregister("html")
- if gmac then
- set ghtmlnormfont to "Times"
- set ghtmlttfont to "Courier"
- set ghtmlheadfont to "Helvetica"
- set ghtmlfontsize to 9
- set ghtmlpath to the moviePath
- else
- set ghtmlnormfont to "Times Roman"
- set ghtmlttfont to "Courier New"
- set ghtmlheadfont to "Arial"
- set ghtmlfontsize to 11
- set ghtmlpath to the moviePath
- end if
- set ghtmllinkred to 255
- set ghtmllinkgreen to 0
- set ghtmllinkblue to 0
- set ghtmlsmoothness to 0
- set ghtmlmargin to 5
- htmlsetdefaults("html")
- end
-
- on htmlsetdefaults mem
- global ghtmlnormfont, ghtmlheadfont, ghtmlttfont, ghtmlfontsize, ghtmllinkred, ghtmllinkgreen, ghtmllinkblue, ghtmlsmoothness, ghtmlmargin
- repeat with i = 1 to 7
- setdefault(member mem, "NORM" & string(i), ghtmlnormfont, ghtmlfontsize + i)
- setdefault(member mem, "TT" & string(i), ghtmlttfont, ghtmlfontsize + i)
- if i < 7 then
- setdefault(member mem, "HEAD" & string(i), ghtmlheadfont, ghtmlfontsize + 20 - (3 * i))
- end if
- end repeat
- setlinkcolor(member mem, ghtmllinkred, ghtmllinkgreen, ghtmllinkblue)
- set the scrollsmooth of member mem to ghtmlsmoothness
- set the margin of member mem to ghtmlmargin
- end
-
- on htmlredraw mem
- set the html of member mem to the html of member mem
- end
-
- on htmlclear mem
- set the html of member mem to EMPTY
- end
-
- on htmlload mem, File
- cursor(4)
- set myFile to new(xtra("FileIO"))
- openFile(myFile, File, 1)
- if status(myFile) then
- set Source to "<HTML><BODY><P><B>Error opening file:</B><BR>" & File & "<BR><A HREF=" & QUOTE & "index.htm" & QUOTE & ">return to Table of contents.</A></P></BODY></HTML>"
- else
- set Source to readFile(myFile)
- if status(myFile) then
- alert("Error while reading from file:" & RETURN & File)
- set Source to EMPTY
- end if
- closeFile(myFile)
- end if
- set myFile to VOID
- set the html of member mem to Source
- set Source to VOID
- cursor(-1)
- end
-
- on htmldolinkabs mem, URL
- global glasturl, ghtmlpath
- set glasturl to URL
- set path to ghtmlpath & url2path(glasturl)
- htmlload(mem, ghtmlpath & url2path(glasturl))
- end
-
- on htmldolinkrel mem, URL
- global glasturl, gmac, gsep
- set URL to concaturl(glasturl, URL)
- htmldolinkabs(mem, URL)
- end
-
- on htmlgetmeta
- global metalist
- set metalist to []
- set metalist to the metalist of member "html"
- set metacount to count(metalist)
- set str to EMPTY
- if metacount then
- repeat with i = 1 to metacount
- if i > 1 then
- set str to str & RETURN
- end if
- set str to str & char 1 to i of " " & getAt(getAt(metalist, i), 1) & " (" & getAt(getAt(metalist, i), 2) & ")"
- end repeat
- end if
- set the text of field "meta" to str
- end
-
- on url2path URL
- global gmac, gsep
- set path to EMPTY
- set olddel to the itemDelimiter
- set the itemDelimiter to "/"
- set cnt to the number of items in URL
- repeat with i = 1 to cnt
- if i > 1 then
- set path to path & gsep
- end if
- set path to path & item i of URL
- end repeat
- set the itemDelimiter to olddel
- return path
- end
-
- on concaturl base, link
- global gsep
- set baselist to []
- set linklist to []
- set URL to EMPTY
- set olddel to the itemDelimiter
- set the itemDelimiter to "/"
- set basecnt to the number of items in base
- repeat with i = 1 to basecnt
- add(baselist, item i of base)
- end repeat
- set linkcnt to the number of items in link
- repeat with i = 1 to linkcnt
- add(linklist, item i of link)
- end repeat
- deleteAt(baselist, basecnt)
- set basecnt to count(baselist)
- repeat while getAt(linklist, 1) = ".."
- deleteAt(baselist, basecnt)
- set basecnt to count(baselist)
- end repeat
- set linkcnt to count(linklist)
- repeat with i = 1 to linkcnt
- addAt(baselist, count(baselist) + 1, getAt(linklist, i))
- end repeat
- set basecnt to count(baselist)
- repeat with i = 1 to basecnt
- if i > 1 then
- set URL to URL & the itemDelimiter
- end if
- set URL to URL & getAt(baselist, i)
- end repeat
- set the itemDelimiter to olddel
- return URL
- end
-
- on convertpc2url str
- set olddel to the itemDelimiter
- set the itemDelimiter to "\"
- set anz to the number of items in str
- set res to EMPTY
- repeat with i = 2 to anz
- if i > 2 then
- set res to res & "/"
- end if
- set res to res & item i of str
- end repeat
- set the itemDelimiter to olddel
- return res
- end
-